package main

import (
	"fmt"
	"strings"
)

func main() {
	var str string = "Hello, World!"
	fmt.Println("the position of \"Hello\" is:")
	fmt.Println(strings.Index(str, "Hello")) //打印str中字符串"hello"的位置
	fmt.Println("the position of \"World\" is:")
	fmt.Println(strings.Index(str, "World"))
	fmt.Println("the position of \"hahaha\" is:")
	fmt.Println(strings.Index(str, "hahaha")) //打印str中字符串"hahaha"的位置,不存在所以会输出-1
	var a string
	a = strings.Replace(str, "Hello", "Hi", 1) //字符串替换
	fmt.Println(a)
	var b int
	b = strings.Count(str, "l") //字符串计数
	fmt.Println(b)
	var c string
	c = strings.Repeat(str, 3) // 字符串重复
	fmt.Println(c)
	c = strings.ToLower(str) // 字符串转小写
	fmt.Println(c)
	c = strings.ToUpper(str) // 字符串转大写
	fmt.Println(c)

}
